package com.hexacta.hrs.test.data;

import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.vectrics.recruiter.job.JobTerm;

/**
 * Test data dependency creator for the JobTerm class.
 * 
 * @author tpollak
 */
public class JobTermTestDataDependencyCreator extends AbstractTestDataDependencyCreator {

    public static final String UNASSIGNED_JOB_TERM = "UNASSIGNED_JOB_TERM";

    public JobTermTestDataDependencyCreator(List<TestDataDependencyCreator> dependencies) {
        super(dependencies);
    }

    public void createDependentTestData(Map<String, Object> context) {
        // Create one JobTerm for unassigned
        JobTerm unassigned = this.createJobTerm(context, "unassigned", "Unassigned term");
        unassigned = this.insertDomainObject(unassigned);
        this.storeObjectReferenceInContext(context, UNASSIGNED_JOB_TERM, unassigned);
    }

    @Override
    public Set<Scenario> getApplicableScenarios() {
        return EnumSet.of(Scenario.DEVELOPMENT);
    }

    private JobTerm createJobTerm(Map<String, Object> context, String code, String description) {
        JobTerm term = new JobTerm();
        term.setCode(code);
        term.setDescription(description);
        term.setIsEmployee(true);
        return term;
    }
}
